<html>
<head>
	<title>Excersise 3</title>
	<link href="styles/js-console.css" rel="stylesheet" />
</head>
<body>
	<div id="js-console"></div>
	<script src="scripts/js-console.js"></script>
	<script>

	function CountSubst(text,substr)
	{
	var text = text;
	var lowText = text.toLowerCase();
	var substr = substr;
	var i;
	var counter=0;
	for (i=0;i<lowText.length;i++)
	{
		for(i=0;i<text.length;i++)
		{
			if((lowText.indexOf(substr,(i))!=-1))
			{
				i = lowText.indexOf(substr,(i));
				counter++;
			}
		}
	}
	jsConsole.writeLine("the word: '" + substr + "' in");
	jsConsole.writeLine(text);
		jsConsole.writeLine(" contains " + counter + " times");
	}
	var text = "We are living in an yellow submarine. We don't have anything else. Inside the submarine is very tight. So we are drinking all the day. We will move out of it in 5 days.";
	var substr = 'in';
	CountSubst(text,substr);
	</script>
</body>
</html>
